define(function(required, exports, nodules) {
  var modal = require("mods/modal");
  exports.re_down = function(ols) {
    $("." + ols).dropdown({
      on: "hover"
    });
  };

  exports.re_set = function() {
    $(".re-save").click(function() {
      if ($(this).hasClass("disabled")) {
        modal.alert("系统正在处理中~~,请不要重复请求");
        return false;
      }

      var opertion_id = $("input[name=opertion-id]").val();
      var _csrf = $("#csrf").val();
      var re_id = $("input[name=re-id]").val();
      $(this).addClass("disabled");
      $.ajax({
        url: "/admin/recommend/set",
        type: "POST",
        dataType: "json",
        data: {
          opertion_id: opertion_id,
          _csrf: _csrf,
          re_id: re_id
        },
        success: function(res) {
          $(this).removeClass("disabled");
          if (res.code == 200) {
            modal.msg(res.msg, {}, function() {
              location.href = "/admin/recommend/index";
            });
          } else {
            modal.alert(res.msg);
            return false;
          }
        }
      });
    });
  };
});
